<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #dv {
            width: 200px;
            height: 400px;
            border: 1px solid #000;
        }
    </style>
</head>

<body>
    <input type="button" value="添加" id="btn">
    <div id="dv"></div>
        <script>
            var odiv = document.getElementById('dv');
            var btn = document.getElementById('btn');
            var arr = ['zxj', 'gqq', 'pyr', 'gb']
            btn.onclick  = function() {
                var ul = document.createElement('ul');
                for(var i = 0; i < arr.length;i++){
                    var li = document.createElement('li');
                    li.innerHTML = arr[i];
                    ul.appendChild(li);
                    odiv.appendChild(ul);
                    li.onmouseover = mouseoverHandle;
                    li.onmouseout = mouseoutHandle;
                }
            }
            function mouseoverHandle() {
                this.style.backgroundColor = "red";
            }
            function mouseoutHandle() {
                this.style.backgroundColor = "";
            }
        </script>
</body>

</html>